package com.wuji1626.spark.rdd.create

import org.apache.spark.{SparkConf, SparkContext}

object RDD_Memory_Parallelism_SparkConf {

  def main(args: Array[String]): Unit = {
    // Step1: 准备环境
    val sparkConf = new SparkConf().setMaster("local[*]").setAppName("RDDCreate")
    sparkConf.set("spark.default.parallelism","5")

    val sc = new SparkContext(sparkConf)

    // Step2: 创建 RDD
    val rdd = sc.makeRDD(List(1, 2, 3, 4))
    // 将 rdd 内容处理成分区文件
    rdd.saveAsTextFile("output")

    // Step3: 关闭环境
    sc.stop()
  }

}
